﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Model;

namespace TradeMarkSys
{
    public partial class FrmMain : Form
    {
        public static User CurrentUser { set; get; }
        public FrmMain()
        {
            InitializeComponent();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            try
            {
                this.Hide();
                FrmLogin fl = new FrmLogin(this);
                fl.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemRegTradeMark_Click(object sender, EventArgs e)
        {
            try
            {
                FrmRegTradeMark frtm = new FrmRegTradeMark();
                frtm.MdiParent = this;
                frtm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemReply_Click(object sender, EventArgs e)
        {
            try
            {

            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemDelete_Click(object sender, EventArgs e)
        {
            try
            {
                FrmDelTrademark frtm = new FrmDelTrademark();
                frtm.MdiParent = this;
                frtm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemSearch_Click(object sender, EventArgs e)
        {
            try
            {
                FrmQueryTrademark fqt = new FrmQueryTrademark();
                fqt.MdiParent = this;
                fqt.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemValidity_Click(object sender, EventArgs e)
        {
            try
            {
                FrmValidityQuery fvq = new FrmValidityQuery();
                fvq.MdiParent = this;
                fvq.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemChangePWD_Click(object sender, EventArgs e)
        {
            try
            {
                FrmChangePWD fcpwd = new FrmChangePWD();
                fcpwd.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void ToolStripMenuItemExit_Click(object sender, EventArgs e)
        {
            try
            {
                Application.Exit();
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }

        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定要退出吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    e.Cancel = false;
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("对不起系统出现错误");
            }
        }
    }
}
